package com.a.a;

import java.nio.charset.Charset;
import java.nio.charset.spi.CharsetProvider;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;

public class b extends CharsetProvider {
    private static final String[] a = new String[]{"UNICODE-1-1-UTF-7", "CSUNICODE11UTF7", "X-RFC2152", "X-RFC-2152"};
    private static final String[] b = new String[]{"X-RFC2152-OPTIONAL", "X-RFC-2152-OPTIONAL"};
    private static final String[] c = new String[]{"X-IMAP-MODIFIED-UTF-7", "X-IMAP4-MODIFIED-UTF7", "X-IMAP4-MODIFIED-UTF-7", "X-RFC3501", "X-RFC-3501"};
    private Charset d = new d("UTF-7", a, false);
    private Charset e = new d("X-UTF-7-OPTIONAL", b, true);
    private Charset f = new c("X-MODIFIED-UTF-7", c);
    private List g = Arrays.asList(new Object[]{this.d, this.f, this.e});

    public Charset charsetForName(String str) {
        String toUpperCase = str.toUpperCase(Locale.US);
        for (Charset charset : this.g) {
            if (charset.name().equals(toUpperCase)) {
                return charset;
            }
        }
        for (Charset charset2 : this.g) {
            if (charset2.aliases().contains(toUpperCase)) {
                return charset2;
            }
        }
        return null;
    }

    public Iterator charsets() {
        return this.g.iterator();
    }
}
